MACRO(SIGAR_TEST name)
	ADD_EXECUTABLE(${name} ${name}.c)
	TARGET_LINK_LIBRARIES(${name}  sigar)
	ADD_TEST(${name} ${name})
ENDMACRO(SIGAR_TEST name)

INCLUDE_DIRECTORIES(../include/)

MESSAGE(STATUS "CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}")

## linux
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_LINUX)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")

## macosx, freebsd
IF(CMAKE_SYSTEM_NAME MATCHES "(Darwin|FreeBSD)")
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_DARWIN)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "(Darwin|FreeBSD)")

## solaris
IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)" )
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_SOLARIS)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)" )

## solaris
IF (CMAKE_SYSTEM_NAME MATCHES "(hpux)" )
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_HPUX)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "(hpux)" )

## aix
IF (CMAKE_SYSTEM_NAME MATCHES "(AIX)" )
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_AIX)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "(AIX)" )

IF(WIN32)
  ADD_DEFINITIONS(-DSIGAR_TEST_OS_WIN32)
ENDIF(WIN32)

SIGAR_TEST(t_sigar_cpu)
SIGAR_TEST(t_sigar_fs)
SIGAR_TEST(t_sigar_loadavg)
SIGAR_TEST(t_sigar_mem)
SIGAR_TEST(t_sigar_netconn)
SIGAR_TEST(t_sigar_netif)
SIGAR_TEST(t_sigar_pid)
SIGAR_TEST(t_sigar_proc)
SIGAR_TEST(t_sigar_reslimit)
SIGAR_TEST(t_sigar_swap)
SIGAR_TEST(t_sigar_sysinfo)
SIGAR_TEST(t_sigar_uptime)
# SIGAR_TEST(t_sigar_version)
